<h1 class="kf">Building Knopflerfish</h1>

Knopflerfish includes an ant based build system for building a
complete Knopflerfish distribution as well as building <a
href="programming.html">individual bundles</a>. Ant 1.9.3 or later is
required, available from <a
href="http://ant.apache.org/">ant.apache.org</a>

<p>
Knopflerfish can be built either by 
 <a href="https://www.knopflerfish.org/git_info.html">
   checking out the entire source code
</a>,
or by (re)building an installed distribution.
</p>

<p>
 The top level build file is located in the <code>osgi</code>
 directory. The default target is to build the framework and all
 bundles in the bundles directory.
</p>

<p>
Invoking ant with the -p option will display the possible targets.
</p>

<pre class="shell">
$ ant -p
Buildfile: build.xml

Main targets:

 all                  Builds the framework and all bundles including optional and test bundles
 bundle_doc           Builds bundle specific docs
 bundle_tasks         Builds and defines the Knopflerfish bundle tasks
 clean                Removes all generated files and directories.
 clean_local          Remove all bundles built by this build-file but keep all other bundles
                      in the jars sub-directory.
 default              Builds the framework and bundles in bundles-directory
 define_bundle_tasks  Defines the Knopflerfish bundle tasks
 javadoc              Create javadoc for all exported packages
 rebuild              Cleans then build build all
 run                  (Re)start the framework.
 run-init             Initial start with default set of bundles.
 run-kf-tests         Builds then executes the KF testsuite.
 run-kf-tests-secure  Builds then executes the KF testsuite with security enabled.
 run-secure           (Re)start framework with security enabled.
 run-secure-init      Initial start with security enabled and default set of bundles.
Default target: default
$ 
</pre>

<p>
To add and build additional bundles see the <a
href="programming.html">programming</a> section.
</p>

<h2 class="kf">Building a compact Knopflerfish framework</h2>

You can build a compact version of the framework called
<code>framework_compact.jar</code>. To build this you need to download
<a href="http://proguard.sourceforge.net/">Proguard 5.2</a>.
Install the proguard.jar file into ${KF_ROOT}/ant/lib and build
the framework with the property <code>compact</code> set to
<code>true</code>.
<p>
This a version with a reduced memory footprint. This version has
no security and certificate support compiled into it. This is only
supposed to be used for running and not to compile against. So you
also need to compile the normal <code>framework.jar</code> to be able
to build bundles.
</p>
<pre class="shell">
$ ant -Dcompact=true -f framework/build.xml 
Buildfile: /Users/jan/workspace_osgi/kf_osgi/osgi/framework/build.xml

compile:

compile_full:

compile_compact:

chkBundleTaskSrc:

chkBundleTasksBuild:

build_bundle_tasks:

define_bundle_tasks:

bundle_tasks:

genexports:
   [delete] Deleting: /Users/jan/workspace_osgi/kf_osgi/osgi/framework/resources/exports

jar:
   [delete] Deleting: /Users/jan/workspace_osgi/kf_osgi/osgi/framework/resources/version
   [delete] Deleting: /Users/jan/workspace_osgi/kf_osgi/osgi/framework/resources/tstamp

writerelease:

jar_file_full:

jar_file_compact:
      [jar] Building jar: /Users/jan/workspace_osgi/kf_osgi/osgi/framework_compact.jar

proguard_compact:
     [move] Moving 1 file to /Users/jan/workspace_osgi/kf_osgi/osgi
 [proguard] ProGuard, version 5.2
 [proguard] Reading program jar [/Users/jan/workspace_osgi/kf_osgi/osgi/framework_compact.jar.tmp.jar]
 [proguard] Reading library jar [/Users/jan/workspace_osgi/kf_osgi/osgi/ee/ee.minimum.jar]
 [proguard] Preparing output jar [/Users/jan/workspace_osgi/kf_osgi/osgi/framework_compact.jar]
 [proguard]   Copying resources from program jar [/Users/jan/workspace_osgi/kf_osgi/osgi/framework_compact.jar.tmp.jar]
   [delete] Deleting: /Users/jan/workspace_osgi/kf_osgi/osgi/framework_compact.jar.tmp.jar

add_dex:

source.jar:

save_javadoc_data:

javadoc.jar:

all:

BUILD SUCCESSFUL
Total time: 14 seconds
$ ls -l framework*jar
-rw-r--r--  1 jan  staff  617250 16 Okt 10:44 framework.jar
-rw-r--r--  1 jan  staff  323070 16 Okt 10:44 framework_compact.jar
$ 
</pre>
